@import '../../styles/themes/default.less';

.rk-radio {
  display: flex;
  align-items: center;
  overflow: hidden;
  cursor: pointer;
  user-select: none;

  &-group {
    &--horizontal {
      display: flex;
      flex-wrap: wrap;
    }
  }

  &--disabled {
    cursor: not-allowed;
  }

  &--label-disabled {
    cursor: default;
  }

  &--horizontal {
    margin-right: @padding-sm;
  }

  &__icon {
    flex: none;
    height: 1em;
    font-size: @radio-size;
    line-height: 1em;
    cursor: pointer;

    .rk-radio__icon-success {
      position: relative;
      display: block;
      box-sizing: border-box;
      width: 1.25em;
      height: 1.25em;
      color: transparent;
      font-size: 0.8em;
      line-height: 1.25;
      text-align: center;
      border: 1px solid @radio-border-color;
      transition-duration: @radio-transition-duration;
      transition-property: color, border-color, background-color;

      &::after {
        position: absolute;
        top: 0.3em;
        left: 0.42em;
        display: table;
        box-sizing: border-box;
        width: 0.3em;
        height: 0.48em;
        border: 2px solid #fff;
        border-top: 0;
        border-left: 0;
        -webkit-transform: rotate(45deg) scale(0);
        transform: rotate(45deg) scale(0);
        transition: all 0.2s ease-in-out;
        content: '';
      }
    }

    &--round {
      .rk-radio__icon-success {
        border-radius: 100%;
      }
    }

    &--square {
      .rk-radio__icon-success {
        border-radius: 4px;
      }
    }

    &--checked {
      .rk-radio__icon-success {
        color: @white;
        background-color: @radio-checked-icon-color;
        border-color: @radio-checked-icon-color;

        &::after {
          transform: rotate(45deg) scale(1);
          transition: all 0.2s ease-in-out;
        }
      }
    }

    &--disabled {
      cursor: not-allowed;

      .rk-radio__icon-success {
        background-color: @radio-disabled-background-color;
        border-color: @radio-disabled-icon-color;
      }
    }

    &--disabled&--checked {
      .rk-radio__icon-success::after {
        border-color: @radio-disabled-icon-color;
      }
    }
  }

  &__label {
    margin-left: @radio-label-margin;
    color: @radio-label-color;
    line-height: @radio-size;

    &--left {
      margin: 0 @radio-label-margin 0 0;
    }

    &--disabled {
      color: @radio-disabled-label-color;
    }
  }
}
